import { _ as n, c as s, o as a, b as t, d as o } from './app.9ea9a1e7.js';
const e =
    '{"title":"国际化","description":"","frontmatter":{},"headers":[{"level":2,"title":"I18n-ally 插件","slug":"i18n-ally-插件"},{"level":2,"title":"配置默认语言","slug":"配置默认语言"},{"level":2,"title":"配置","slug":"配置"},{"level":3,"title":"语言文件","slug":"语言文件"},{"level":3,"title":"语言导入逻辑说明","slug":"语言导入逻辑说明"},{"level":2,"title":"使用","slug":"使用"},{"level":2,"title":"切换语言","slug":"切换语言"},{"level":2,"title":"新增","slug":"新增"},{"level":3,"title":"语言文件","slug":"语言文件-1"},{"level":3,"title":"新增语言","slug":"新增语言"},{"level":2,"title":"远程读取语言数据","slug":"远程读取语言数据"},{"level":3,"title":"setupI18n 函数","slug":"setupi18n-函数"},{"level":3,"title":"changeLocale 函数","slug":"changelocale-函数"}],"relativePath":"dep/i18n.md","lastUpdated":1632875926697}',
  c = {},
  l = [
    t(
      'h1',
      { id: '国际化' },
      [
        t('a', { class: 'header-anchor', href: '#国际化', 'aria-hidden': 'true' }, '#'),
        o(' 国际化'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('如果你使用的 vscode 开发工具，则推荐安装 '),
        t(
          'a',
          {
            href: 'https://marketplace.visualstudio.com/items?itemName=Lokalise.i18n-ally',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'I18n-ally',
        ),
        o(' 这个插件'),
      ],
      -1,
    ),
    t(
      'h2',
      { id: 'i18n-ally-插件' },
      [
        t('a', { class: 'header-anchor', href: '#i18n-ally-插件', 'aria-hidden': 'true' }, '#'),
        o(' I18n-ally 插件'),
      ],
      -1,
    ),
    t('p', null, '安装了该插件后，你的代码内可以实时看到对应的语言内容', -1),
    t('p', null, [t('img', { src: '/doc-next/images/i18n.png', alt: '' })], -1),
    t(
      'h2',
      { id: '配置默认语言' },
      [
        t('a', { class: 'header-anchor', href: '#配置默认语言', 'aria-hidden': 'true' }, '#'),
        o(' 配置默认语言'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('在 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/settings/localeSetting.ts',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/settings/localeSetting.ts',
        ),
        o(' 内可以配置默认语言'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'export'),
            o(),
            t('span', { class: 'token keyword' }, 'const'),
            o(),
            t('span', { class: 'token constant' }, 'LOCALE'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(),
            t('span', { class: 'token punctuation' }, '['),
            o('key'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token builtin' }, 'string'),
            t('span', { class: 'token punctuation' }, ']'),
            t('span', { class: 'token operator' }, ':'),
            o(' LocaleType '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  '),
            t('span', { class: 'token constant' }, 'ZH_CN'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'zh_CN'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token constant' }, 'EN_US'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'en'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'export'),
            o(),
            t('span', { class: 'token keyword' }, 'const'),
            o(' localeSetting'),
            t('span', { class: 'token operator' }, ':'),
            o(' LocaleSetting '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  '),
            t('span', { class: 'token comment' }, '// 是否显示语言选择器'),
            o('\n  showPicker'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'true'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token comment' }, '// 当前语言'),
            o('\n  locale'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token constant' }, 'LOCALE'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token constant' }, 'ZH_CN'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token comment' }, '// 默认语言'),
            o('\n  fallback'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token constant' }, 'LOCALE'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token constant' }, 'ZH_CN'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token comment' }, '// 允许的语言'),
            o('\n  availableLocales'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token punctuation' }, '['),
            t('span', { class: 'token constant' }, 'LOCALE'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token constant' }, 'ZH_CN'),
            t('span', { class: 'token punctuation' }, ','),
            o(),
            t('span', { class: 'token constant' }, 'LOCALE'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token constant' }, 'EN_US'),
            t('span', { class: 'token punctuation' }, ']'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token comment' }, '// 配置语言列表'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'export'),
            o(),
            t('span', { class: 'token keyword' }, 'const'),
            o(' localeList'),
            t('span', { class: 'token operator' }, ':'),
            o(' DropMenu'),
            t('span', { class: 'token punctuation' }, '['),
            t('span', { class: 'token punctuation' }, ']'),
            o(),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token punctuation' }, '['),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n    text'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'简体中文'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    event'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'zh_CN'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n    text'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'English'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    event'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'en'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n'),
            t('span', { class: 'token punctuation' }, ']'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h2',
      { id: '配置' },
      [t('a', { class: 'header-anchor', href: '#配置', 'aria-hidden': 'true' }, '#'), o(' 配置')],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('在 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/setupI18n.ts',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/setupI18n.ts',
        ),
        o(' 内引入的 i18n 这个无需修改'),
      ],
      -1,
    ),
    t(
      'h3',
      { id: '语言文件' },
      [
        t('a', { class: 'header-anchor', href: '#语言文件', 'aria-hidden': 'true' }, '#'),
        o(' 语言文件'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('在 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/lang',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/lang/',
        ),
        o(' 可以配置具体的语言'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-bash' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token comment' }, '# locales/lang/'),
            o('\n\n'),
            t('span', { class: 'token comment' }, '# 中文语言'),
            o(
              '\nzh_CN:\n  component: 组件相关\n  layout: 布局相关\n  routes: 路由菜单相关\n  sys: 系统页面相关\n\nen: 同上\n\n',
            ),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h3',
      { id: '语言导入逻辑说明' },
      [
        t('a', { class: 'header-anchor', href: '#语言导入逻辑说明', 'aria-hidden': 'true' }, '#'),
        o(' 语言导入逻辑说明'),
      ],
      -1,
    ),
    t('ol', null, [t('li', null, '初始化')], -1),
    t(
      'p',
      null,
      [
        o('在 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/setupI18n.ts',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/setupI18n',
        ),
        o(' 内的根语言文件可以看到'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'const'),
            o(' defaultLocal '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token keyword' }, 'await'),
            o(),
            t('span', { class: 'token keyword' }, 'import'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token template-string' }, [
              t('span', { class: 'token template-punctuation string' }, '`'),
              t('span', { class: 'token string' }, './lang/'),
              t('span', { class: 'token interpolation' }, [
                t('span', { class: 'token interpolation-punctuation punctuation' }, '${'),
                o('locale'),
                t('span', { class: 'token interpolation-punctuation punctuation' }, '}'),
              ]),
              t('span', { class: 'token string' }, '.ts'),
              t('span', { class: 'token template-punctuation string' }, '`'),
            ]),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('这会导入 '),
        t('code', null, 'src/locales/lang/{lang}.ts'),
        o(' 文件语言包，此文件会导入对应语言下的所有文件。'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'import'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' genMessage '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token keyword' }, 'from'),
            o(),
            t('span', { class: 'token string' }, "'../helper'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'import'),
            o(' antdLocale '),
            t('span', { class: 'token keyword' }, 'from'),
            o(),
            t('span', { class: 'token string' }, "'ant-design-vue/es/locale/zh_CN'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'import'),
            o(' momentLocale '),
            t('span', { class: 'token keyword' }, 'from'),
            o(),
            t('span', { class: 'token string' }, "'moment/dist/locale/zh-cn'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'const'),
            o(' modules '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token keyword' }, 'import'),
            t('span', { class: 'token punctuation' }, '.'),
            o('meta'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'globEager'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token string' }, "'./zh_CN/**/*.ts'"),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'export'),
            o(),
            t('span', { class: 'token keyword' }, 'default'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  message'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n    '),
            t('span', { class: 'token operator' }, '...'),
            t('span', { class: 'token function' }, 'genMessage'),
            t('span', { class: 'token punctuation' }, '('),
            o('modules'),
            t('span', { class: 'token punctuation' }, ','),
            o(),
            t('span', { class: 'token string' }, "'zh_CN'"),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    antdLocale'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  momentLocale'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  momentLocaleName'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'zh-cn'"),
            t('span', { class: 'token punctuation' }, ','),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t('p', null, '并将其按相应的目录结构转化为多层级的', -1),
    t('p', null, '例:', -1),
    t('p', null, [t('code', null, 'lang/zh_CN/components/modal.ts'), o(' 的文件内容为')], -1),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  title'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token string' }, "'标题'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('则在使用的使用直接使用 '),
        t('code', null, "t('components.modal.title')"),
        o(' 进行获取。'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      '这样做的好处在于更容易管理大型项目的多语言。如果不需要分模块划分，可以直接自己手动导入即可。',
      -1,
    ),
    t(
      'h2',
      { id: '使用' },
      [t('a', { class: 'header-anchor', href: '#使用', 'aria-hidden': 'true' }, '#'), o(' 使用')],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('引入项目自带的 '),
        t('code', null, 'useI18n'),
        o(),
        t('strong', null, '注意不要引入 vue-i18n 的 useI18n'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'import'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' useI18n '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token keyword' }, 'from'),
            o(),
            t('span', { class: 'token string' }, "'/@/hooks/web/useI18n'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'const'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' t '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token function' }, 'useI18n'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'const'),
            o(' title '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token function' }, 't'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token string' }, "'components.modal.title'"),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h2',
      { id: '切换语言' },
      [
        t('a', { class: 'header-anchor', href: '#切换语言', 'aria-hidden': 'true' }, '#'),
        o(' 切换语言'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('切换语言需要使用 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/useLocale.ts',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/useLocale.ts',
        ),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'import'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' useLocale '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token keyword' }, 'from'),
            o(),
            t('span', { class: 'token string' }, "'/@/locales/useLocale'"),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'const'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' changeLocale '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token function' }, 'useLocale'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n'),
            t('span', { class: 'token function' }, 'changeLocale'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token string' }, "'en'"),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h2',
      { id: '新增' },
      [t('a', { class: 'header-anchor', href: '#新增', 'aria-hidden': 'true' }, '#'), o(' 新增')],
      -1,
    ),
    t(
      'h3',
      { id: '语言文件-1' },
      [
        t('a', { class: 'header-anchor', href: '#语言文件-1', 'aria-hidden': 'true' }, '#'),
        o(' 语言文件'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('在 '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/lang',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/lang/',
        ),
        o(' 增加对应语言的文件即可'),
      ],
      -1,
    ),
    t(
      'h3',
      { id: '新增语言' },
      [
        t('a', { class: 'header-anchor', href: '#新增语言', 'aria-hidden': 'true' }, '#'),
        o(' 新增语言'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('目前项目自带的语言只有 '),
        t('code', null, 'zh_CN'),
        o(' 和 '),
        t('code', null, 'en'),
        o(' 两种'),
      ],
      -1,
    ),
    t('p', null, '如果需要新增，按以下操作即可', -1),
    t(
      'ol',
      null,
      [
        t('li', null, [
          o('在 '),
          t(
            'a',
            {
              href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/lang',
              target: '_blank',
              rel: 'noopener noreferrer',
            },
            'src/locales/lang/',
          ),
          o(' 下新增相应的语言目录及语言文件并引入 引入 ant-design-vue 和 moment 对应的语言包'),
        ]),
        t('li', null, [
          o('在 '),
          t(
            'a',
            {
              href: 'https://github.com/anncwb/vue-vben-admin/tree/main/types/config',
              target: '_blank',
              rel: 'noopener noreferrer',
            },
            'types/config.d.ts',
          ),
          o(' 内加上预览类型定义'),
        ]),
        t('li', null, [
          o('在 '),
          t(
            'a',
            {
              href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/settings/localeSetting.ts',
              target: '_blank',
              rel: 'noopener noreferrer',
            },
            'src/settings/localeSetting.ts',
          ),
          o(' 修改语言配置'),
        ]),
      ],
      -1,
    ),
    t(
      'h2',
      { id: '远程读取语言数据' },
      [
        t('a', { class: 'header-anchor', href: '#远程读取语言数据', 'aria-hidden': 'true' }, '#'),
        o(' 远程读取语言数据'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('目前项目会在 '),
        t('code', null, 'src/main.ts'),
        o(' 内等待 '),
        t('code', null, 'setupI18n'),
        o(
          ' 这个函数执行完之后才会渲染界面，所以只需在 setupI18n 内发送 ajax 请求，将对应的数据设置到 i18n 实例上即可',
        ),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token comment' }, '// src/main.ts'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'await'),
            o(),
            t('span', { class: 'token function' }, 'setupI18n'),
            t('span', { class: 'token punctuation' }, '('),
            o('app'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\napp'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'mount'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token string' }, "'#app'"),
            t('span', { class: 'token punctuation' }, ','),
            o(),
            t('span', { class: 'token boolean' }, 'true'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h3',
      { id: 'setupi18n-函数' },
      [
        t('a', { class: 'header-anchor', href: '#setupi18n-函数', 'aria-hidden': 'true' }, '#'),
        o(' setupI18n 函数'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('代码: '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/setupI18n.ts',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/setupI18n/',
        ),
      ],
      -1,
    ),
    t(
      'p',
      null,
      '如下所示，这里会先设置一个默认语言，默认语言可以设置在本地，也可以在这里等待接口返回默认语言',
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token comment' }, '// setup i18n instance with glob'),
            o('\n'),
            t('span', { class: 'token keyword' }, 'export'),
            o(),
            t('span', { class: 'token keyword' }, 'async'),
            o(),
            t('span', { class: 'token keyword' }, 'function'),
            o(),
            t('span', { class: 'token function' }, 'setupI18n'),
            t('span', { class: 'token punctuation' }, '('),
            o('app'),
            t('span', { class: 'token operator' }, ':'),
            o(' App'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' options '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token keyword' }, 'await'),
            o(),
            t('span', { class: 'token function' }, 'createI18nOptions'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  i18n '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token function' }, 'createI18n'),
            t('span', { class: 'token punctuation' }, '('),
            o('options'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token keyword' }, 'as'),
            o(' I18n'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  app'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'use'),
            t('span', { class: 'token punctuation' }, '('),
            o('i18n'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            o('\n\n'),
            t('span', { class: 'token keyword' }, 'async'),
            o(),
            t('span', { class: 'token keyword' }, 'function'),
            o(),
            t('span', { class: 'token function' }, 'createI18nOptions'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token builtin' }, 'Promise'),
            t('span', { class: 'token operator' }, '<'),
            o('I18nOptions'),
            t('span', { class: 'token operator' }, '>'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' locale '),
            t('span', { class: 'token operator' }, '='),
            o(' localeStore'),
            t('span', { class: 'token punctuation' }, '.'),
            o('getLocale'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  '),
            t('span', { class: 'token comment' }, '// 这里改成接口获取'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' defaultLocal '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token keyword' }, 'await'),
            o(),
            t('span', { class: 'token keyword' }, 'import'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token template-string' }, [
              t('span', { class: 'token template-punctuation string' }, '`'),
              t('span', { class: 'token string' }, './lang/'),
              t('span', { class: 'token interpolation' }, [
                t('span', { class: 'token interpolation-punctuation punctuation' }, '${'),
                o('locale'),
                t('span', { class: 'token interpolation-punctuation punctuation' }, '}'),
              ]),
              t('span', { class: 'token string' }, '.ts'),
              t('span', { class: 'token template-punctuation string' }, '`'),
            ]),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' message '),
            t('span', { class: 'token operator' }, '='),
            o(' defaultLocal'),
            t('span', { class: 'token punctuation' }, '.'),
            o('default'),
            t('span', { class: 'token operator' }, '?.'),
            o('message '),
            t('span', { class: 'token operator' }, '??'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  '),
            t('span', { class: 'token keyword' }, 'return'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n    legacy'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'false'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    locale'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    fallbackLocale'),
            t('span', { class: 'token operator' }, ':'),
            o(' fallback'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    messages'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n      '),
            t('span', { class: 'token punctuation' }, '['),
            o('locale'),
            t('span', { class: 'token punctuation' }, ']'),
            t('span', { class: 'token operator' }, ':'),
            o(' message'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    '),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    availableLocales'),
            t('span', { class: 'token operator' }, ':'),
            o(' availableLocales'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    sync'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'true'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    silentTranslationWarn'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'true'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    missingWarn'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'false'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n    silentFallbackWarn'),
            t('span', { class: 'token operator' }, ':'),
            o(),
            t('span', { class: 'token boolean' }, 'true'),
            t('span', { class: 'token punctuation' }, ','),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '}'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
    t(
      'h3',
      { id: 'changelocale-函数' },
      [
        t('a', { class: 'header-anchor', href: '#changelocale-函数', 'aria-hidden': 'true' }, '#'),
        o(' changeLocale 函数'),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('代码: '),
        t(
          'a',
          {
            href: 'https://github.com/anncwb/vue-vben-admin/tree/main/src/locales/useLocale',
            target: '_blank',
            rel: 'noopener noreferrer',
          },
          'src/locales/useLocale/',
        ),
      ],
      -1,
    ),
    t(
      'p',
      null,
      [
        o('当手动切换语言的时候会触发 '),
        t('code', null, 'useLocale'),
        o(' 函数，useLocale 也是异步函数，只需等待接口返回响应的数据后，再进行设置即可'),
      ],
      -1,
    ),
    t(
      'div',
      { class: 'language-ts' },
      [
        t('pre', null, [
          t('code', null, [
            t('span', { class: 'token keyword' }, 'async'),
            o(),
            t('span', { class: 'token keyword' }, 'function'),
            o(),
            t('span', { class: 'token function' }, 'changeLocale'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token operator' }, ':'),
            o(' LocaleType'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' globalI18n '),
            t('span', { class: 'token operator' }, '='),
            o(' i18n'),
            t('span', { class: 'token punctuation' }, '.'),
            o('global'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' currentLocale '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token function' }, 'unref'),
            t('span', { class: 'token punctuation' }, '('),
            o('globalI18n'),
            t('span', { class: 'token punctuation' }, '.'),
            o('locale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'if'),
            o(),
            t('span', { class: 'token punctuation' }, '('),
            o('currentLocale '),
            t('span', { class: 'token operator' }, '==='),
            o(' locale'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token keyword' }, 'return'),
            o(' locale'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  '),
            t('span', { class: 'token keyword' }, 'if'),
            o(),
            t('span', { class: 'token punctuation' }, '('),
            o('loadLocalePool'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'includes'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o('\n    '),
            t('span', { class: 'token function' }, 'setI18nLanguage'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n    '),
            t('span', { class: 'token keyword' }, 'return'),
            o(' locale'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token punctuation' }, '}'),
            o('\n  '),
            t('span', { class: 'token comment' }, '// 这里改成接口获取'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(' langModule '),
            t('span', { class: 'token operator' }, '='),
            o(),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token keyword' }, 'await'),
            o(),
            t('span', { class: 'token keyword' }, 'import'),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token template-string' }, [
              t('span', { class: 'token template-punctuation string' }, '`'),
              t('span', { class: 'token string' }, './lang/'),
              t('span', { class: 'token interpolation' }, [
                t('span', { class: 'token interpolation-punctuation punctuation' }, '${'),
                o('locale'),
                t('span', { class: 'token interpolation-punctuation punctuation' }, '}'),
              ]),
              t('span', { class: 'token string' }, '.ts'),
              t('span', { class: 'token template-punctuation string' }, '`'),
            ]),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token keyword' }, 'as'),
            o(),
            t('span', { class: 'token builtin' }, 'any'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, '.'),
            o('default '),
            t('span', { class: 'token keyword' }, 'as'),
            o(' LangModule'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'if'),
            o(),
            t('span', { class: 'token punctuation' }, '('),
            t('span', { class: 'token operator' }, '!'),
            o('langModule'),
            t('span', { class: 'token punctuation' }, ')'),
            o(),
            t('span', { class: 'token keyword' }, 'return'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  '),
            t('span', { class: 'token keyword' }, 'const'),
            o(),
            t('span', { class: 'token punctuation' }, '{'),
            o(' message'),
            t('span', { class: 'token punctuation' }, ','),
            o(' momentLocale'),
            t('span', { class: 'token punctuation' }, ','),
            o(' momentLocaleName '),
            t('span', { class: 'token punctuation' }, '}'),
            o(),
            t('span', { class: 'token operator' }, '='),
            o(' langModule'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  globalI18n'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'setLocaleMessage'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token punctuation' }, ','),
            o(' message'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  moment'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'updateLocale'),
            t('span', { class: 'token punctuation' }, '('),
            o('momentLocaleName'),
            t('span', { class: 'token punctuation' }, ','),
            o(' momentLocale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  loadLocalePool'),
            t('span', { class: 'token punctuation' }, '.'),
            t('span', { class: 'token function' }, 'push'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n\n  '),
            t('span', { class: 'token function' }, 'setI18nLanguage'),
            t('span', { class: 'token punctuation' }, '('),
            o('locale'),
            t('span', { class: 'token punctuation' }, ')'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n  '),
            t('span', { class: 'token keyword' }, 'return'),
            o(' locale'),
            t('span', { class: 'token punctuation' }, ';'),
            o('\n'),
            t('span', { class: 'token punctuation' }, '}'),
            o('\n'),
          ]),
        ]),
      ],
      -1,
    ),
  ];
var p = n(c, [
  [
    'render',
    function (n, t, o, e, c, p) {
      return a(), s('div', null, l);
    },
  ],
]);
export { e as __pageData, p as default };
